
if (top != self) { top.location.replace(self.location.href); }

/*
function getCookie(name)
{
var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for(var i=0;i < ca.length;i++) {
        var c = ca[i];
        while (c.charAt(0)==' ') c = c.substring(1,c.length);
        if (c.indexOf(nameEQ) == 0) 
		{
		return c.substring(nameEQ.length,c.length);
		}
    }
    return null;
}
*/

$(window).load(function() {
						
/*						
	var feedbackcheck = getCookie("webfeedback");		
	$(window).unload(function() {
	//alert('Handler for .unload() called.');
	var checkdomain = window.top.location.href.match(re)[1].toString();
	if(event.clientY < 0 && (feedbackcheck==null || feedbackcheck=="") && checkdomain == 'www.infosys.com')
		var r=confirm("Your opinion matters to us. Kindly spend 30 seconds giving us feedback on your website experience.\n\n");	
	
	if (r==true)
		window.open("http://infosys.polldaddy.com/s/website-feedback-form", "feedback", "status=off,toolbar=off,location=off,menubar=off,directories=off,resizable=off,scrollbars=off,height=500,width=675,top=10");
	
	});  
						
	*/	
						
						
						
//Main Menu


	$(function(){
		$("ul.dropdown li").hover(function(){
			$(this).addClass("hover");
			$('ul:first',this).css('visibility', 'visible');
			$("ul.dropdown li a.selected").css('border-bottom', '0px solid #ff6600');
			if($(this).children("a").attr('id') != 'home')
			{
				$('body').removeClass("homepage");
				$('body').addClass("innerbg-mm");				
			}
		}, function(){
			$(this).removeClass("hover");
			$('ul:first',this).css('visibility', 'hidden');
			if($('ul:first',this).html() != null || $(this).children("a").attr('id') == 'home')
			$("ul.dropdown li a.selected").css('border-top', '4px solid #ff6600');
			if($(this).children("a").attr('id') != 'home' && $('ul:first',this).html() != null)
			{
				$('body').addClass("homepage");
				$('body').removeClass("innerbg-mm");
			}
		});
		$("ul.dropdown li ul li:has(ul)").find("a").addClass("show-3level");
	});

/* Main Menu OLD
    $(function() {
        $("ul.dropdown li").hover(function() {
            $(this).addClass("hover");
            $('ul:first', this).css('visibility', 'visible');
        }, function() {
            $(this).removeClass("hover");
            $('ul:first', this).css('visibility', 'hidden');
        });

        // $("ul.dropdown li ul li:has(ul)").find("a:first").append(" &raquo; ");
        $("ul.dropdown li ul li:has(ul)").find("a").addClass("show-3level");
    });
*/
    /* Language Country Menu
    $('#language-country').click(function() {
        
		if ($("#infglobal-menu-items1").is(":hidden"))
		{
			$('#container').css('z-index','10011');
			$('#infglobal-menu-items1').slideToggle(500);
		} else {
			$('#infglobal-menu-items1').slideToggle(100);
			$('#container').css('z-index','100');
		}
		
        if (!$("#careers-menu-items").is(":hidden"))
            $('#careers-menu-items').slideToggle(300);
    });
	
    $('#infglobal-menu-items1').mouseleave(function() { $('#infglobal-menu-items1').slideToggle(300); $('#container').css('z-index','100');});
	*/
	    $('#language-country').click(function() {
        $('#infglobal-menu-items1').slideToggle(500);
        if (!$("#careers-menu-items").is(":hidden"))
            $('#careers-menu-items').slideToggle(300);
    });
    $('#infglobal-menu-items1').mouseleave(function() { $('#infglobal-menu-items1').slideToggle(500); });
	
/*Language content*/	
if(window.location.pathname.indexOf('/finacle/',0) != 0)
	$('#infglobal-menu-items1').html('<div class="ulist"><ul><li id="australia">Australia - <a href="/australia/Pages/index.aspx" title="Australia - English">English</a></li> <li id="china">China - <a href="/cn/Pages/index.aspx" title="China - Chinese">Chinese</a></li><li id="france">France - <a href="/france/french/Pages/index.aspx" title="France - French">French</a></li></ul></div><div class="ulist"><ul><li id="germany">Germany - <a href="/german/pages/index.aspx" title="Germany - German">German</a></li><li id="japan">Japan - <a href="/jp/Pages/index.aspx" title="Japan - Japanese">Japanese</a></li><li id="mexico">Mexico - <a href="/mexico/spanish/pages/index.aspx" title="Mexico - Spanish">Spanish</a></li></ul></div>');

    /* careers Menu*/
    $('#careers-master').click(function() {
        $('#careers-menu-items').slideToggle(500);
        if (!$("#infglobal-menu-items1").is(":hidden"))
            $('#infglobal-menu-items1').slideToggle(300);
    });
    $('#careers-menu-items').mouseleave(function() { $('#careers-menu-items').slideToggle(500); });


    // LEAD STORY  //
    $("#leadstory_container div:nth-child(1)").hide();

    this.LEADSTORY = function(type) {
        // random Display//
        if (type == "random") {
            var ran = Math.floor(Math.random() * $("#leadstory_container div").length) + 1;
            //alert($("#leadstory_container div").length);
            $("#leadstory_container div:nth-child(" + ran + ")").show();
        }
        // Cycle Display 
        if (type == "cycle") {
            $('#leadstory_container').after('<div id="mainstory_pager">').cycle({
                fx: 'fade',
                speed: 1000,
                timeout: 4500,
				pause:   1 ,
                //random:  3
                pager: '#mainstory_pager',
                pagerAnchorBuilder: function(idx, slide) { return '<a href="#">&nbsp;</a>'; }
            });
        }
    };

    LEADSTORY('cycle'); //random OR cycle

    // LEAD STORY END //

    // NEWS TICKER //
    if (document.getElementById('news') != null) {
        var options = {
            newsList: "#news",
            tickerRate: 30, 	// time gap between display of each letter (ms)
            startDelay: 100, 	// delay before first run of the ticker (ms)
            loopDelay: 5000, // time for which full text of each item is shown at end of print-out (ms)
            placeHolder1: "", // character placeholder shown on even loops
            placeHolder2: ""	// character placeholder shown on odd loops
        }
        $().newsTicker(options);
    }
    // NEWS TICKER END //
	
	// Announcements  //
	//$("#announcement_container div:nth-child(1)").hide();
	
	this.announcements = function(type) {
		// random Display//
		if (type == "random") {
			var ran = Math.floor(Math.random() * $("#announcement_container div").length) + 1;
			$("#announcement_container div:nth-child(" + ran + ")").show();
		}
		// Cycle Display 
		if (type == "cycle") {
			$('#announcement_container').cycle({
			fx: 'fade',
			speed: 900,
			timeout: 4500
			});
		}
	};	
	announcements('cycle'); //random OR cycle
	
	// Announcements END //	
	

    //SPOTLIGHT Random show//
   // var ran = Math.floor(Math.random() * ($("#c-spot-hd-4 div").length - 2)) + 1;
   // $("#c-spot-hd-4 div:nth-child(" + ran + ")").show();

    //SPOTLIGHT //
    $('#spotlight-1').removeClass('spotlight-1').addClass('');
    $('#spotlight-2').removeClass('spotlight-2').addClass('');
    $('#spotlight-3').removeClass('spotlight-3').addClass('');
    $('#spotlight-4').removeClass('spotlight-4').addClass('');

    $("#spotlight-1").mouseenter(
		function() {
		    $("#updates-container-wrapper").mouseenter(
				function() {
				    $('#spotlight-1-content').stop();
				    $('#spotlight-1-content').removeClass('spotlight-slideup-1').addClass('');
				    $('#c-spot-hd-1').removeClass('c-spot-hd-bg').addClass('');
				    $('#spotlight-1-content').animate({ height: '84px' }, 300);
				});

		    $("#footer-container-wrapper").mouseenter(
				function() {
				    $('#spotlight-1-content').stop();
				    $('#spotlight-1-content').removeClass('spotlight-slideup-1').addClass('');
				    $('#c-spot-hd-1').removeClass('c-spot-hd-bg').addClass('');
				    $('#spotlight-1-content').animate({ height: '84px' }, 300);
				});

		    $('#spotlight-1-content').removeClass('').addClass('spotlight-slideup-1');
		    $('#c-spot-hd-1').removeClass('').addClass('c-spot-hd-bg');
		    $('#spotlight-1-content').animate({ height: '205px' }, 500, function() { $('#spotlight-1-content').removeClass('').addClass('spotlight-slideup-1'); });
		});

    $("#spotlight-1-content").mouseleave(
		function() {
		    $('#spotlight-1-content').animate({ height: '84px' }, 400, function() { $('#c-spot-hd-1').removeClass('c-spot-hd-bg').addClass(''); $('#spotlight-1-content').removeClass('spotlight-slideup-1').addClass(''); });
		});

    $("#spotlight-2").mouseenter(
		function() {
		    $("#updates-container-wrapper").mouseenter(
				function() {
				    $('#spotlight-2-content').stop();
				    $('#spotlight-2-content').removeClass('spotlight-slideup-2').addClass('');
				    $('#c-spot-hd-2').removeClass('c-spot-hd-bg').addClass('');
				    $('#spotlight-2-content').animate({ height: '84px' }, 300);
				});

		    $("#footer-container-wrapper").mouseenter(
				function() {
				    $('#spotlight-2-content').stop();
				    $('#spotlight-2-content').removeClass('spotlight-slideup-2').addClass('');
				    $('#c-spot-hd-2').removeClass('c-spot-hd-bg').addClass('');
				    $('#spotlight-2-content').animate({ height: '84px' }, 300);
				});

		    $('#spotlight-2-content').removeClass('').addClass('spotlight-slideup-2');
		    $('#c-spot-hd-2').removeClass('').addClass('c-spot-hd-bg');
		    $('#spotlight-2-content').animate({ height: '205px' }, 500, function() { $('#spotlight-2-content').removeClass('').addClass('spotlight-slideup-2'); });
		});


    $("#spotlight-2-content").mouseleave(
		function() {
		    $('#spotlight-2-content').animate({ height: '84px' }, 400, function() { $('#c-spot-hd-2').removeClass('c-spot-hd-bg').addClass(''); $('#spotlight-2-content').removeClass('spotlight-slideup-2').addClass(''); });
		});


    $("#spotlight-3").mouseenter(
		function() {
		    $("#updates-container-wrapper").mouseenter(
				function() {
				    $('#spotlight-3-content').stop();
				    $('#spotlight-3-content').removeClass('spotlight-slideup-3').addClass('');
				    $('#c-spot-hd-3').removeClass('c-spot-hd-bg').addClass('');
				    $('#spotlight-3-content').animate({ height: '84px' }, 300);
				});

		    $("#footer-container-wrapper").mouseenter(
				function() {
				    $('#spotlight-3-content').stop();
				    $('#spotlight-3-content').removeClass('spotlight-slideup-3').addClass('');
				    $('#c-spot-hd-3').removeClass('c-spot-hd-bg').addClass('');
				    $('#c-spot-hd-3').removeClass('c-spot-hd-bg').addClass('');
				    $('#spotlight-3-content').animate({ height: '84px' }, 300);
				});

		    $('#spotlight-3-content').removeClass('').addClass('spotlight-slideup-3');
		    $('#c-spot-hd-3').removeClass('').addClass('c-spot-hd-bg');
		    $('#spotlight-3-content').animate({ height: '205px' }, 500, function() { $('#spotlight-3-content').removeClass('').addClass('spotlight-slideup-3'); });
		});


    $("#spotlight-3-content").mouseleave(
		function() {
		    $('#spotlight-3-content').animate({ height: '84px' }, 400, function() { $('#c-spot-hd-3').removeClass('c-spot-hd-bg').addClass(''); $('#spotlight-3-content').removeClass('spotlight-slideup-3').addClass(''); });
		});


    $("#spotlight-4").mouseenter(
		function() {
		    $("#updates-container-wrapper").mouseenter(
				function() {
				    $('#spotlight-4-content').stop();
				    $('#spotlight-4-content').removeClass('spotlight-slideup-4').addClass('');
				    $('#c-spot-hd-4').removeClass('c-spot-hd-bg').addClass('');
				    $('#spotlight-4-content').animate({ height: '84px' }, 300);
				});

		    $("#footer-container-wrapper").mouseenter(
				function() {
				    $('#spotlight-4-content').stop();
				    $('#spotlight-4-content').removeClass('spotlight-slideup-4').addClass('');
				    $('#c-spot-hd-4').removeClass('c-spot-hd-bg').addClass('');
				    $('#spotlight-4-content').animate({ height: '84px' }, 300);
				});

		    $('#spotlight-4-content').removeClass('').addClass('spotlight-slideup-4');
		    $('#c-spot-hd-4').removeClass('').addClass('c-spot-hd-bg');
		    $('#spotlight-4-content').animate({ height: '205px' }, 500, function() { $('#spotlight-4-content').removeClass('').addClass('spotlight-slideup-4'); });
		});

    $("#spotlight-4-content").mouseleave(
		function() {
		    $('#spotlight-4-content').animate({ height: '84px' }, 400, function() { $('#c-spot-hd-4').removeClass('c-spot-hd-bg').addClass(''); $('#spotlight-4-content').removeClass('spotlight-slideup-4').addClass(''); });
		});

    //SPOTLIGHT Random//
    var divLength = $("#c-spot-hd-1 div").length / 2;
    var ran = Math.floor(Math.random() * divLength) + 1;
    $("#c-spot-hd-1 div:nth-child(" + ran + ")").show();

    divLength = $("#c-spot-hd-2 div").length / 2;
    ran = Math.floor(Math.random() * divLength) + 1;
    $("#c-spot-hd-2 div:nth-child(" + ran + ")").show();

    divLength = $("#c-spot-hd-3 div").length / 2;
    ran = Math.floor(Math.random() * divLength) + 1;
    $("#c-spot-hd-3 div:nth-child(" + ran + ")").show();

    divLength = $("#c-spot-hd-4 div").length / 2;
    ran = Math.floor(Math.random() * divLength) + 1;
    $("#c-spot-hd-4 div:nth-child(" + ran + ")").show();
});	
 

